/*
 * $Header: http://kst-ntfs-recovery.googlecode.com/svn/tags/0.1_can_dump_continous_mft/src/diskreader.h 12 2010-01-09 16:41:50Z flekst $ 
 * */

#ifndef DISKREADER_H
#define DISKREADER_H
// 
#include "common.h"
#include "ntfsbootrecord.h"
#include <QFile>
#include <QBuffer>
// 
class               DiskReader:public QObject
{
Q_OBJECT            protected:
                      QFile file;
  bool                ready;

  QBuffer             buffer;

protected:
                      qint64 calcSize ();

public:
                      NTFSBootRecord bs;

  qint64              getSize ()
  {
    if ((this->size == 0) && this->isReady ())
      {
	this->size = this->calcSize ();
      }
    return              size;
  }
  qint64              size;
  bool                goback (qint64 bytes);
  bool                skip (qint64 bytes);
  quint32             read (char *buffer, quint32 len);

  bool                seek (qint64 offset);

  bool                isReady (void);

  DiskReader (const QString filename);
  ~DiskReader ();

};
#endif
